package com.xcj.springai.tools;


import cn.hutool.core.annotation.Alias;
import com.xcj.springai.service.NBAService;
import com.xcj.springai.vo.ChatResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
@RequiredArgsConstructor
@Slf4j
public class NBATool {


    @Autowired
    private NBAService nbaService;




    @Tool(name = "getNBATeam", description = "查询NBA的球队信息", returnDirect = true)
    public ChatResponse getNBATeam() {
        log.info("查询NBA球队信息");
        ChatResponse.ChatResponseBuilder<Object> chatResponse = ChatResponse.builder().done(true);
        Map<String, String> teams = nbaService.getTeams();
        chatResponse.dt(teams).dc("为您查询到以下球队信息");
        return chatResponse.build();
    }

}
